﻿using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Drawing;
using System.Data;
using System.Linq;
using System.Text;
using System.Windows.Forms;

namespace ZhimeiSoft.Framework.Client.Control.DateTimeGrid
{
    public partial class MonthDateTimeForMonth : UserControl
    {
        public DateTime MonthDateTime { get; set; }

        public MonthDateTimeForMonth()
        {
            InitializeComponent();
            MonthDateTime = new DateTime(DateTime.Today.Year, DateTime.Today.Month,
                DateTime.Today.Day);
            initLabelDate(MonthDateTime);
            monthDateTimeForWeek.setDateTime(MonthDateTime);
        }

        private void btnUpMonth_Click(object sender, EventArgs e)
        {
            changeDateMonth(-1);
        }

        private void btnNextMonth_Click(object sender, EventArgs e)
        {
            changeDateMonth(1);
        }

        private void initLabelDate(DateTime dt)
        {
            labelDateTime.Text = string.Concat(dt.Year, "年", dt.Month, "月");
        }

        private void changeDateMonth(int iMonthNumber)
        {
            MonthDateTime = MonthDateTime.AddMonths(iMonthNumber);
            initLabelDate(MonthDateTime);
            monthDateTimeForWeek.setDateTime(MonthDateTime);
        }

    }
}
